package cn.yuan.xiaoyu.testmodule.activity;

import android.graphics.Paint;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.List;

import butterknife.Bind;
import cn.yuan.xiaoyu.R;
import cn.yuan.xiaoyu.commonmodule.activity.BaseActivity;
import cn.yuan.xiaoyu.commonmodule.view.recycleview.YRecycleview;
import cn.yuan.xiaoyu.testmodule.adapter.TestRecycleviewAdapter;

/**
 * Created by yukuoyuan on 2017/3/28.
 * 这是一个验证输入验证码控件的界面
 */

public class InputVcodeViewActivity extends BaseActivity {


    @Bind(R.id.tv_test_delete_line1)
    TextView tvTestDeleteLine1;
    @Bind(R.id.tv_test_delete_line2)
    TextView tvTestDeleteLine2;
    @Bind(R.id.tv_test_delete_line3)
    TextView tvTestDeleteLine3;
    @Bind(R.id.bt_test_dialog_fragment)
    Button btTestDialogFragment;
    @Bind(R.id.rcv_test_01)
    YRecycleview rcvTest01;
    @Bind(R.id.tv_empty)
    TextView tvEmpty;

    @Override
    protected void bindPresenter() {

    }

    @Override
    protected void initData(Bundle extras) {
        tvTestDeleteLine1.getPaint().setFlags(Paint.UNDERLINE_TEXT_FLAG);//下划线
        tvTestDeleteLine2.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG); //中间横线
        tvTestDeleteLine3.getPaint().setAntiAlias(true);// 抗锯齿
        rcvTest01.setLayoutManager(new LinearLayoutManager(this));
//        rcvTest01.setEmptyView(tvEmpty);
        final View view=View.inflate(this, R.layout.item_news_list_img, null);
        rcvTest01.addLoadingEmptyView(view);
        final List<String> list01 = new ArrayList<>();

        final TestRecycleviewAdapter testRecycleviewAdapter01 = new TestRecycleviewAdapter(this,list01);
        rcvTest01.setAdapter(testRecycleviewAdapter01);
        rcvTest01.setRefreshAndLoadMoreListener(new YRecycleview.RefreshAndLoadMoreListener() {
            @Override
            public void onRefresh() {
                rcvTest01.setLoadingEmptyViewGone();
                rcvTest01.setReFreshComplete();
                for (int i = 0; i < 20; i++) {
                    list01.add("测试**" + i);
                }
                testRecycleviewAdapter01.notifyDataSetChanged();

            }

            @Override
            public void onLoadMore() {
                list01.clear();
                testRecycleviewAdapter01.notifyDataSetChanged();
                rcvTest01.addLoadingEmptyView(view);
                rcvTest01.loadMoreComplete();

            }
        });
    }

    @Override
    public int getContentLayout() {
        return R.layout.activity_test_vcode_input;
    }

    @Override
    protected void initToolbar() {

    }
}
